package com.dal.plugin;

import com.dal.db.DbSave;
import com.dal.job.DBSaveJob;
import com.jfinal.plugin.IPlugin;
import com.sojoys.artifact.plugin.quartz.QuartzPlugin;
import com.xiaoleilu.hutool.log.Log;
import com.xiaoleilu.hutool.log.LogFactory;

import java.util.Date;

/**
 * @author : DengYing
 * @CreateDate : 2017年4月28日 上午12:04:53
 * @Description ：数据存储插件
 */
public class DBSavePlugin implements IPlugin {
	static Log log = LogFactory.get(DBSavePlugin.class);

	@Override
	public boolean start() {
		DbSave.init();
//		QuartzPlugin.addJob("DBSavePlugin", "DBSavePlugin", new Date(), "0 0/5 * * * ?", DBSaveJob.class, null);
		return true;
	}

	@Override
	public boolean stop() {
//		try {
//			DbSave.saveAll();
//			return DbSave.shutdownAll();
//		} catch (Exception e) {
//			log.error(e);
//		}
		return false;
	}

}
